package examples;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;

public class SQLExample{

public static void main(String args[]){
  String dbtime;
  String dbUrl = "jdbc:mysql://localhost/progin_171_13509096";
  String dbClass = "com.mysql.jdbc.Driver";
  String query = "Select * FROM users";
  String username = "progin";
  String password = "progin";
  
  try {
  
    Class.forName(dbClass);
    Connection con = DriverManager.getConnection(dbUrl, username, password);
    Statement stmt = con.createStatement();
    ResultSet rs = stmt.executeQuery(query);
  
    while (rs.next()) {
      dbtime = rs.getString(1);
      System.out.println(dbtime);
    }  //end while
  
    con.close();
  }  //end try
  
  catch(ClassNotFoundException e) {
    e.printStackTrace();
  }
  
  catch(SQLException e) {
    e.printStackTrace();
  }

}  //end main

}  //end class